Fix opaque S3 error messages for AWS permission issues #604
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Problem
When AWS S3 permissions are missing (e.g.,
s3:HeadBucket), Preevy fails with an unhelpful "403: UnknownError" message that provides no indication the problem is S3-related or which specific AWS permission is missing. This makes it difficult for users to diagnose and resolve permission issues.Solution
Enhanced error handling in the S3 filesystem implementation (
packages/driver-lightsail/src/fs/index.ts) to provide clear, actionable error messages that:Before vs After
Before (opaque):
After (clear and actionable):
Implementation
createS3Error()helper function to wrap S3 operations with contextual error messagesensureBucketExists()to provide specific context for HeadBucket/CreateBucket failuresread,write,delete)Testing
This fix directly addresses the issue where users with missing S3 permissions (like the reported
s3:HeadBucketcase) now get clear guidance on which AWS permissions need to be configured.Original prompt
✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.